﻿@model PetaPoco.Pager
@{
    var controller = Html.ViewContext.RouteData.Values["controller"].ToString();
    var action = Html.ViewContext.RouteData.Values["action"].ToString();
}
<div class="pagination">
    <ul>
        <li class="disabled"><a>数量: @(Model.ItemsPerPage > Model.TotalItems ? Model.TotalItems : Model.ItemsPerPage)
            / @Model.TotalItems, 页数 @Model.CurrentPage / @Model.TotalPages</a></li>
        @if (Model.CurrentPage == 1)
        {
            <li class="disabled"><a>首页</a></li>
            <li class="disabled"><a>上页</a></li>
        }
        else
        {
            <li><a href="@Url.Action(action, controller, new { page = (long)1 })">首页</a></li>
            <li><a href="@Url.Action(action, controller, new { page = Model.CurrentPage - 1 })">上页</a></li>
        }
        @if (Model.CurrentPage == Model.TotalPages)
        {
            <li class="disabled"><a>下页</a></li>
            <li class="disabled"><a>尾页</a></li>
        }
        else
        {
            <li><a href="@Url.Action(action, controller, new { page = Model.CurrentPage + 1 })">下页</a></li>
            <li><a href="@Url.Action(action, controller, new { page = Model.TotalPages })">尾页</a></li>
        }
    </ul>
</div>
